package com.jt.consumer.service;

import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author CCFu
 * @version 1.0
 * @date 2022/1/18 19:16
 */
@Component
public class ProviderFallbackFactory implements FallbackFactory<RemoteProviderService> {
    @Override
    public RemoteProviderService create(Throwable throwable) {
//        return new RemoteProviderService() {
//            @Override
//            public String echoMessage(String string) {
//                //............
//                return "服务忙,稍等片刻再访问";
//            }
//        };
        return (string) ->{//JDK8 lamdba
            //............
            return "服务忙,稍等片刻再访问....";
        };

    }
}
